package br.com.rodrigo.resources;

import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import br.com.rodrigo.activemq.Postador;
import br.com.rodrigo.bean.TesteUser;
import br.com.rodrigo.constants.Constants;

@Path(Constants.TESTE_URI_PATH)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Component
public class TesteResource
{

    private final Logger logger = LoggerFactory.getLogger(TesteResource.class);

    @Autowired
    private TesteUser teste;

    @GET
    @Path("{" + Constants.SEND_MESSAGE + "}")
    public Response teste(@HeaderParam("message") final String msg)
    {

        new Postador().sendMessage(msg, "jms/queue/MyQueue");

        return Response.status(Status.OK).build();
    }
}
